package com.demo.多线程;

interface Marry {
    void startMarry();
}

/**
 * @Program: java
 * @ClassName StaticProxy
 * @Author: liutao
 * @Description: 静态代理实现婚庆结婚
 * @Create: 2023-10-26 23:19
 * @Version 1.0
 **/
public class StaticProxy {
    public static void main(String[] args) {
        WeddingCompany weddingCompany = new WeddingCompany(new You());
        weddingCompany.startMarry();
    }

}

class You implements Marry {
    @Override
    public void startMarry() {
        System.out.println("某某结婚了");
    }
}

class WeddingCompany implements Marry {
    private final Marry target;

    public WeddingCompany(Marry target) {
        this.target = target;
    }

    @Override
    public void startMarry() {
        before();
        this.target.startMarry();
        after();
    }

    private void after() {
        System.out.println("收尾款");
    }

    private void before() {
        System.out.println("布置现场");
    }
}

